#! /usr/bin/env python
# -*- coding: utf-8 -*-

# Copyright (c) Huoty, All rights reserved
# Author: Huoty <sudohuoty@163.com>
# CreateTime: 2021-07-29 10:22:32

from multiprocessing import Process
import os
import sys


def worker(name):
    print('Run child process %s (%s)...' % (name, os.getpid()))
    n = 0
    while True:
        #n = (10 + 10) / 5 * 4 - 10
        pass


if __name__=='__main__':
    print('Parent process %s.' % os.getpid())
    count = int(sys.argv[1])

    print('Child process will start.')
    proc_list = []
    for idx in range(count):
        p = Process(target=worker, args=(idx,))
        p.start()
        proc_list.append(p)
    for p in proc_list:
        p.join()
    print('Child process end.')
